<?php

/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/**
 *
 * @package    symfony
 * @subpackage plugin
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardRouting.class.php 15757 2009-02-24 21:15:40Z Kris.Wallsmith $
 */
class sfCMSRouting
{
    /**
   * Listens to the routing.load_configuration event.
   *
   * @param sfEvent An sfEvent instance
   */
    static public function listenToRoutingLoadConfigurationEvent(sfEvent $event)
    {
        $r = $event->getSubject();

        // preprend our routes
        //$r->prependRoute('static_page', new sfRoute('/:category_alias/:type_alias/:alias.html', array('module' => 'sfCMSfront', 'action' => 'view_static_page')));

        $r->prependRoute('admin_config', new sfPropelRouteCollection(array(
        'name'                 => 'admin_config',
        'model'                => 'AdminConfig',
        'module'               => 'admin_config',
        'prefix_path'          => 'admin_config',
        'with_wildcard_routes' => true,
        'requirements'         => array(),
        )));
        $r->prependRoute('menu', new sfPropelRouteCollection(array(
        'name'                 => 'menu',
        'model'                => 'Menu',
        'column'               => 'id',
        'module'               => '/menu',
        'prefix_path'          => 'menu',
        'with_wildcard_routes' => true,
        'requirements'         => array(),
        )));
        $r->prependRoute('menu_item', new sfPropelRouteCollection(array(
        'name'                 => 'menu_item',
        'model'                => 'MenuItem',
        'module'               => 'menu_item',
        'prefix_path'          => 'menu_item',
        'with_wildcard_routes' => true,
        'requirements'         => array(),
        )));
        $r->prependRoute('menu', new sfPropelRouteCollection(array(
        'name'                 => 'content',
        'model'                => 'Content',
        'module'               => 'content',
        'prefix_path'          => 'content',
        'with_wildcard_routes' => true,
        'requirements'         => array(),
        )));
        $r->prependRoute('category', new sfPropelRouteCollection(array(
        'name'                 => 'category',
        'model'                => 'Category',
        'module'               => 'category',
        'prefix_path'          => 'category',
        'with_wildcard_routes' => true,
        'requirements'         => array(),
        )));


        $r->prependRoute('menu_item2', new sfPropelRoute('/:sf_culture/:alias_url.html',array(
        'module'  => 'sfCMSfront',
        'action'  => 'menuFirst'
        ),array(
        //'alias_url'=>'\s+',
        'sf_culture'=> '(?:ar|en|fa)',/*
        'sf_method'=>'post'*/
        ),array(
        'name'                 => 'menu_item',
        'model'                => 'MenuItem',
        'column'                => 'alias_url',
        //'method'                => 'retriveByAliasUrl',
        'type'          => 'object',
        )));

        $r->prependRoute('content_show', new sfRoute('/:sf_culture/content_show/:id',array(
        'module'  => 'sfCMSfront',
        'action'  => 'showContent'
        )));


        $r->prependRoute('category_show', new sfRoute('/category_show/:id',array(
        'module'  => 'sfCMSfront',
        'action'  => 'showCategory'
        )));

        $r->prependRoute('homepage_culture', new sfRoute('/:sf_culture/',array(
        'module'  => 'main',
        'action'  => 'index'
        )));
        
        $r->prependRoute('cms_profile_register', new sfRoute('/:sf_culture/registeration',array(
        'module'  => 'cms_profile',
        'action'  => 'register'
        )));   
             
        $r->prependRoute('cms_profile_req_password', new sfRoute('/:sf_culture/request_password',array(
        'module'  => 'cms_profile',
        'action'  => 'req_password'
        )));
             
        $r->prependRoute('cms_profile_activiate', new sfRoute('/:sf_culture/registeration/activiate/:key',array(
        'module'  => 'cms_profile',
        'action'  => 'activiate'
        )));             
        
        $r->prependRoute('cms_profile_edit_profile', new sfRoute('/:sf_culture/edit_profile',array(
        'module'  => 'cms_profile',
        'action'  => 'editProfile'
        )));
                 
        
        $r->prependRoute('cms_profile_change_password', new sfRoute('/:sf_culture/change_password',array(
        'module'  => 'cms_profile',
        'action'  => 'change_password'
        )));
        
        
    }

}
